home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Mac Magazin/MacEasy 37
/
Mac Magazin and MacEasy Magazine CD - Issue 37.iso
/
Software
/
Entwickler
/
sonstige
/
Visual Balloons DR3
/
Visual Balloons™ Example
/
Sources
/
PP Basic Starter.cp
Wrap
Text File
|
1997-08-07
|
4KB
|
152 lines
// ===========================================================================
// PP Basic Starter.cp ©1994-1997 Metrowerks Inc. All rights reserved.
// ===========================================================================
//
// This file contains the starter code for a basic PowerPlant application
#include "PP Basic Starter.h"
#include <LGrowZone.h>
#include <LWindow.h>
#include <PP_Messages.h>
#include <PP_Resources.h>
#include <PPobClasses.h>
#include <UDrawingState.h>
#include <UMemoryMgr.h>
#include <URegistrar.h>
#include <LEditField.h>
#include "UVisualBalloons.hpp"
// put declarations for resource ids (ResIDTs) here
const ResIDT window_Sample = 1; // EXAMPLE
// ===========================================================================
// • Main Program
// ===========================================================================
void main(void)
{
// Set Debugging options
SetDebugThrow_(debugAction_Alert);
SetDebugSignal_(debugAction_Alert);
InitializeHeap(3); // Initialize Memory Manager
// Parameter is number of Master Pointer
// blocks to allocate
// Initialize standard Toolbox managers
UQDGlobals::InitializeToolbox(&qd);
new LGrowZone(20000); // Install a GrowZone function to catch
// low memory situations.
CPPStarterApp theApp; // replace this with your App type
theApp.Run();
}
// ---------------------------------------------------------------------------
// • CPPStarterApp // replace this with your App type
// ---------------------------------------------------------------------------
// Constructor
CPPStarterApp::CPPStarterApp()
{
// Register functions to create core PowerPlant classes
RegisterAllPPClasses();
UVisualBalloons::Initialize ( );
}
// ---------------------------------------------------------------------------
// • ~CPPStarterApp // replace this with your App type
// ---------------------------------------------------------------------------
// Destructor
//
CPPStarterApp::~CPPStarterApp()
{
}
// ---------------------------------------------------------------------------
// • StartUp
// ---------------------------------------------------------------------------
// This function lets you do something when the application starts up
// without a document. For example, you could issue your own new command.
void
CPPStarterApp::StartUp()
{
ObeyCommand(cmd_New, nil); // EXAMPLE, create a new window
}
// ---------------------------------------------------------------------------
// • ObeyCommand
// ---------------------------------------------------------------------------
// Respond to commands
Boolean
CPPStarterApp::ObeyCommand(
CommandT inCommand,
void *ioParam)
{
Boolean cmdHandled = true;
switch (inCommand) {
// Deal with command messages (defined in PP_Messages.h).
// Any that you don't handle will be passed to LApplication
case cmd_New:
// EXAMPLE, create a new window
LWindow *theWindow;
theWindow = LWindow::CreateWindow(window_Sample, this);
theWindow->Show();
break;
default:
cmdHandled = LApplication::ObeyCommand(inCommand, ioParam);
break;
}
return cmdHandled;
}
// ---------------------------------------------------------------------------
// • FindCommandStatus
// ---------------------------------------------------------------------------
// This function enables menu commands.
//
void
CPPStarterApp::FindCommandStatus(
CommandT inCommand,
Boolean &outEnabled,
Boolean &outUsesMark,
Char16 &outMark,
Str255 outName)
{
switch (inCommand) {
// Return menu item status according to command messages.
// Any that you don't handle will be passed to LApplication
case cmd_New: // EXAMPLE
outEnabled = true; // enable the New command
break;
default:
LApplication::FindCommandStatus(inCommand, outEnabled,
outUsesMark, outMark, outName);
break;
}
}